﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace MrdocUtils.Common
{
    public class ImageUtil
    {
        /// <summary>
        /// 图片转换成base64编码文本
        /// </summary>
        public static string ImgToBase64String(string path)
        {

            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            byte[] buffer = new byte[fs.Length];
            fs.Read(buffer, 0, (int)fs.Length);
            string base64String = Convert.ToBase64String(buffer);
            return base64String;
        }
    }
}
